package wangtiles;

/** Beatty sequence : a way to represent a number with a sequence of integers
 * 
 * @author decomite
 *
 */

public class BeattySequence {
	private double value; 
	/* Not valid for numbers <10-3*/
	private int sequence[]=new int[1000]; 
	
	private static int intFloor(double u){
			return (int)Math.floor(u); 
	}
	
	public BeattySequence(double v){
		int am1=intFloor(-v); 
		for(int i=0;i<1000;i++){
			int am2=intFloor(i*v); 
			sequence[i]=am2-am1; 
			am1=am2; 
			}	
		}
	
	public String sequ(){
		String s=""; 
		for(int i=0;i<100;i++)
			s+=sequence[i]+","; 
		return s; 
	}
	public int get(int i){return this.sequence[i]; }

}
